package com.midian.model.banner;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.midian.common.utils.StringUtil;
import com.midian.model.activity.Activity;
import com.midian.model.activity.ActivityType;
import com.midian.model.common.BaseModel;
import com.midian.model.pic.Pic;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Type;

import com.vividsolutions.jts.geom.Point;

/**
 * banner广告
 * 
 */
@Entity
@Table(name = "banner")
public class Banner extends BaseModel {
	/**优先级*/
	private Integer priority;
	@ManyToOne(optional=true,fetch=FetchType.LAZY)
	@JoinColumn(name="picId")
	@NotFound(action=NotFoundAction.IGNORE)
	private Pic bannerPic;
	@ManyToOne(optional=true,fetch=FetchType.LAZY)
	@JoinColumn(name="activityId")
	@NotFound(action=NotFoundAction.IGNORE)
	private Activity activity;
	private String detail;

	
	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public Integer getPriority() {
		return priority;
	}

	public Pic getBannerPic() {
		return bannerPic;
	}

	public void setBannerPic(Pic bannerPic) {
		this.bannerPic = bannerPic;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}
	
	
	public Activity getActivity() {
		return activity;
	}

	public void setActivity(Activity activity) {
		this.activity = activity;
	}
	
	
	/**活动图片地址*/
	@Transient
	public String getActivityPicIp() {
		String activityPicIp="";
		if (this.bannerPic!=null) {
			activityPicIp = StringUtil.getImageTips(this.bannerPic.getId());
		}
		return activityPicIp;
		
	}
	
	/**活动详情描述*/
	@Transient
	public String getBannerDetailTips() {
		String bannerDetailTips="";
		if (this.detail!=null) {
			bannerDetailTips = StringUtil.replaceToHtmlQuot(this.detail);;
		}
		return bannerDetailTips;
		
	}

	
}
